home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * Copyright © 1992-1993 Mark Pilgrim *
- * *
- * This file is provided as is, and may be freely distributed unaltered. This *
- * message must accompany any copy of this file. This file may be used or *
- * modified for use for a non-commercial product provided that appropriate *
- * credit is given to the author named above. *
- * Commercial use of this source code is prohibited. *
- ******************************************************************************/
-
- #include "msg misc.h"
- #include "msg timing.h"
-
- #define BoxSize 2
- #define CorrectTime 3
-
- void MrDoOutdone(GrafPtr);
-
- /* 25 regions on screen, in a 5 x 5 grid. Regions alternate as to whether they
- scroll up or down. */
-
- void MrDoOutdone(GrafPtr sourceGrafPtr)
- {
- int x, y;
- int vgap,hgap;
- Rect theRect, dest;
- Rect scrollsource, scrolldest;
- Rect bounds[25];
-
- vgap=MAIN_WINDOW_HEIGHT/5;
- hgap=MAIN_WINDOW_WIDTH/5;
-
- for (x=0; x<25; x++)
- {
- switch (x)
- {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- bounds[x].top=0;
- break;
- case 15:
- case 16:
- case 17:
- case 18:
- case 5:
- bounds[x].top=vgap;
- break;
- case 14:
- case 23:
- case 24:
- case 19:
- case 6:
- bounds[x].top=vgap*2;
- break;
- case 13:
- case 22:
- case 21:
- case 20:
- case 7:
- bounds[x].top=vgap*3;
- break;
- case 12:
- case 11:
- case 10:
- case 9:
- case 8:
- bounds[x].top=vgap*4;
- break;
- }
- switch (x)
- {
- case 0:
- case 15:
- case 14:
- case 13:
- case 12:
- bounds[x].left=0;
- break;
- case 1:
- case 16:
- case 23:
- case 22:
- case 11:
- bounds[x].left=hgap;
- break;
- case 2:
- case 17:
- case 24:
- case 21:
- case 10:
- bounds[x].left=hgap*2;
- break;
- case 3:
- case 18:
- case 19:
- case 20:
- case 9:
- bounds[x].left=hgap*3;
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- bounds[x].left=hgap*4;
- break;
- }
- bounds[x].bottom=bounds[x].top+vgap;
- bounds[x].right=bounds[x].left+hgap;
- }
-
- for (x=BoxSize; x<vgap; x+=BoxSize)
- {
- StartTiming();
- for (y=0; y<25; y++)
- {
- if (y%2) /* these scroll up */
- {
- scrollsource=bounds[y];
- scrollsource.top+=BoxSize;
- scrolldest=scrollsource;
- OffsetRect(&scrolldest,0,-BoxSize);
-
- dest=bounds[y];
- dest.top=dest.bottom-BoxSize;
-
- theRect=bounds[y];
- theRect.top+=x-BoxSize;
- theRect.bottom=theRect.top+BoxSize;
-
- CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
- &scrollsource, &scrolldest, 0, 0L);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &theRect, &dest, 0, 0L);
- }
- else /* these scroll down */
- {
- scrollsource=bounds[y];
- scrollsource.bottom-=BoxSize;
- scrolldest = scrollsource;
- OffsetRect(&scrolldest, 0, BoxSize);
-
- dest=bounds[y];
- dest.bottom=dest.top+BoxSize;
-
- theRect=bounds[y];
- theRect.bottom-=x-BoxSize;
- theRect.top=theRect.bottom-BoxSize;
-
- CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
- &scrollsource, &scrolldest, 0, 0L);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &theRect, &dest, 0, 0L);
- }
- }
- TimeCorrection(CorrectTime);
- }
- for (y=0; y<25; y++)
- {
- CopyBits(&(sourceGrafPtr->portBits),&(gMainWindow->portBits),
- &bounds[y],&bounds[y],0,0L); /* fill in any missing bits */
- }
- }
-